<template>
	<page>
    <view class="record-list">
      <view class="list" v-for="(item,index) in recordList" :key="index">
        <view class="icon">
          <image src="/static/images/icon/zft_icon.png" v-if="item.wallet_type === 0"></image>
          <image src="/static/images/icon/hbt_icon.png" v-else-if="item.wallet_type === 1"></image>
        </view>
        <view class="title-date">
          <view class="title">
            <text class="one-omit">{{item.desc}}</text>
          </view>
          <view class="date">
            <text>{{item.create_time}}</text>
          </view>
        </view>
        <view class="price">
          <text class="add" v-if="item.type === 1">+ {{item.price}}</text>
          <text class="sub" v-else>- {{item.price}}</text>
        </view>
      </view>
    </view>
	</page>
</template>

<script setup>

import {rechargeRecord} from "../../../api/wallet";
import {ref} from "vue";
import {onLoad} from "@dcloudio/uni-app";

const recordList = ref([]);

onLoad(() =>{
  getData();
})
// 分页
let pageSize = 1;
let total = 0;

function getData(){
  rechargeRecord({
    limit: 20,
    page: pageSize,
  }).then(res =>{
    if(pageSize === 1){
      recordList.value = res.data.result;
      total = res.data.total;
      console.log(recordList.value);
    }else{
      recordList.value = [...recordList.value,...res.data.result];
    }
  })
}
</script>

<style lang="scss">
  @import "WalletRecord.scss";
</style>
